#pragma region License
/*
MIT License
Copyright © 2006 The Mono.Xna Team

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this->software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this->permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma endregion License

#ifndef RQuaternion_h
#define RQuaternion_h

#include <Defines.h>
#include <CSharpPropertyMethods.h>

#include <System/Collections/Generic/IEquatable.h>
#include <System/Array.h>
#include <System/Math.h>
#include <System/String.h>

//using System;
//#if WINRT
//using System.Runtime.Serialization;
//#endif

namespace Riccsson
{
	namespace Xna
	{
		namespace Framework
		{
			// Forward decleration.
			struct Matrix;
			struct Vector3;

			struct Quaternion : public Riccsson::System::Collections::Generic::IEquatable<Quaternion>
			{
				public: float X;
				public: float Y;
				public: float Z;
				public: float W;
	 
				public: static const Quaternion& Identity;
				//PROP3(Quaternion, GC_PTR<Quaternion>, Identity)
				//PROP3(Quaternion, Vector3, Xyz) // Internally.

				public: Quaternion();
				public: Quaternion(float x, float y, float z, float w);
				public: Quaternion(Vector3& vectorPart, float scalarPart);
				public: static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2);
				public: static void Add(Quaternion ref quaternion1, Quaternion ref quaternion2, Quaternion out result);
				public: static Quaternion Concatenate(Quaternion value1, Quaternion value2);
				public: static void Concatenate(Quaternion ref value1, Quaternion ref value2, Quaternion out result);
				public: void Conjugate();
				public: static Quaternion Conjugate(Quaternion value);
				public: static void Conjugate(Quaternion ref value, Quaternion out result);
				public: static Quaternion CreateFromAxisAngle(Vector3& axis, float angle);
				public: static void CreateFromAxisAngle(Vector3 ref axis, float angle, Quaternion out result);
				public: static Quaternion CreateFromRotationMatrix(Matrix& matrix);
				public: static void CreateFromRotationMatrix(Matrix ref matrix, Quaternion out result);
				public: static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll);
 				public: static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, Quaternion out result);
				public: static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2);
				public: static void Divide(Quaternion ref quaternion1, Quaternion ref quaternion2, Quaternion out result);
				public: static float Dot(Quaternion quaternion1, Quaternion quaternion2);
				public: static void Dot(Quaternion ref quaternion1, Quaternion ref quaternion2, float out result);
				public: override bool Equals(const Quaternion* obj) const;
				public: bool Equals(Quaternion other) const;
				public: override int GetHashCode();
				public: static Quaternion Inverse(Quaternion quaternion);
				public: static void Inverse(Quaternion ref quaternion, Quaternion out result);
				public: float Length();
				public: float LengthSquared();

				public: static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount);
				public: static void Lerp(Quaternion ref quaternion1, Quaternion ref quaternion2, float amount, Quaternion out result);
				public: static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount);
				public: static void Slerp(Quaternion ref quaternion1, Quaternion ref quaternion2, float amount, Quaternion out result);
				public: static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2);
				public: static void Subtract(Quaternion ref quaternion1, Quaternion ref quaternion2, Quaternion out result);
				public: static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2);
				public: static Quaternion Multiply(Quaternion quaternion1, float scaleFactor);
				public: static void Multiply(Quaternion ref quaternion1, float scaleFactor, Quaternion out result);
				public: static void Multiply(Quaternion ref quaternion1, Quaternion ref quaternion2, Quaternion out result);
				public: static Quaternion Negate(Quaternion quaternion);
				public: static void Negate(Quaternion ref quaternion, Quaternion out result);
				public: void Normalize();
				public: static Quaternion Normalize(Quaternion quaternion);
				public: static void Normalize(Quaternion ref quaternion, Quaternion out result);
				public: override GC_PTR<Riccsson::System::string> ToString();

				public: /*internal*/ GC_PTR<Matrix> ToMatrix();
				public: /*internal*/ void ToMatrix (Matrix out matrix);
				public: /*internal*/ static void ToMatrix(Quaternion quaternion, Matrix out matrix);

				///*internal*/ public: PORP3_GET(Vector3, Xyz)
				//{
				//	return Vector3(X, Y, Z);
				//}
				///*internal*/ public: PORP3_SET(Vector3, Xyz)
				//{
				//	X = value.X;
				//	Y = value.Y;
				//	Z = value.Z;
				//}
			};

			
			Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2);
			Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2);
			bool operator ==(Quaternion quaternion1, Quaternion quaternion2);
			bool operator !=(Quaternion quaternion1, Quaternion quaternion2);
			Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2);
			Quaternion operator *(Quaternion quaternion1, float scaleFactor);
			Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2);
			Quaternion operator -(Quaternion quaternion);
		}
	}
}

#endif